package top.zhangjianyong.tools.constant;

import top.zhangjianyong.tools.entity.Vegetable;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Stream;

/**
 * @author ： zhangjianyong
 * @date ： 2022/11/23 9:10 AM
 */
public class CanteenMealFilter {

    public static final Predicate<Vegetable> NOODLE_FILTER = m -> {

        String[] split = m.getDescription().split("\\+");
        List<String> list = new ArrayList();
        for (String s : split) {
            list.add(s.trim().substring(s.length() - 1));
        }
        return list.size() < 3 && list.contains("面") && (list.contains("汤") || list.contains("奶"));
    };

    public static final Predicate<Vegetable> NOODLE_NO_JTM_FILTER = m -> {
        return !m.getDescription().contains("姜汤面")
                && NOODLE_FILTER.test(m);
    };

    public static final Predicate<Vegetable> HAMBURGER_FILTER = m -> {
        String[] split = m.getDescription().split("\\+");
        return Stream.of(split).anyMatch(v -> v.contains("汉堡"));
    };

    public static final Predicate<Vegetable> TAOCAN_E_FILTER = m -> {
        return m.getName().contains("套餐E");
    };
    public static final Predicate<Vegetable> TAOCAN_C_FILTER = m -> {
        return m.getName().contains("套餐C");
    };
    public static final Predicate<Vegetable> TAOCAN_D_FILTER = m -> {
        return m.getName().contains("套餐D");
    };
}
